// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import * as echarts from 'echarts'

const COLOR = [
  new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    { offset: 0, color: 'rgba(24,187,255,.2)' },
    { offset: 0.8, color: 'transparent' },
  ]),
]

const axis = {
  axisLabel: {
    color: '#A6C7DB',
  },
  splitLine: {
    show: true,
    lineStyle: {
      color: 'rgba(94,118,132,.5)',
      type: 'dashed',
    },
  },
  axisTick: {
    show: false,
  },
}

// ============================== 导出配置 ============================== //

export default {
  grid: {
    top: 10,
    left: 10,
    right: 16,
    bottom: 0,
    containLabel: true,
  },

  xAxis: CORE.merge({}, axis, {
    data: [],
    boundaryGap: false,
    axisLabel: {
      interval: 5,
      formatter: (v) => v.slice(-5, -3),
    },
    axisLine: {
      color: '#A6C7DB',
      lineStyle: {
        color: '#5E7684',
        width: 2,
      },
    },
  }),

  yAxis: CORE.merge({}, axis, {
    minInterval: 1,
    axisLine: {
      color: '#5E7684',
      lineStyle: {
        color: 'transparent',
      },
    },
  }),

  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'cross',
      label: {
        backgroundColor: '#6a7985',
      },
    },
  },

  series: [
    {
      name: `${CORE.MAP.ALARM}数`,
      type: 'line',
      smooth: 0.3,
      data: [],
      showSymbol: false,
      itemStyle: {
        color: '#16BBFF',
      },
      lineStyle: {
        width: 2,
        color: '#16BBFF',
      },
      areaStyle: {
        color: COLOR[0],
      },
    },
  ],
}
